﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

/// <summary>
/// DBConnection 数据库连接类
/// </summary>
public class DBConnection
{
	public DBConnection()
	{
		//
		// TODO: 在此处添加构造函数逻辑
		//
	}
    /// <summary>
    /// 该f方法创建数据库连接，从Web.Config获得数据库连接字符串。
    /// </summary>   
    /// <returns>返回一个Sqlconection连接</returns>
    public static SqlConnection CreateConnection()
    {        
            string DBConnectionString = System.Configuration.ConfigurationManager.AppSettings["DBConnectionString"];
            SqlConnection conn = new SqlConnection(DBConnectionString);
            return conn;
        
    }

}
